package com.xujiang.imitationcompanypj.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.etekcity.vesync.common.adapter.BaseRecyclerAdapter;
import com.etekcity.vesync.common.adapter.holder.BaseRecyclerViewHolder;
import com.xujiang.imitationcompanypj.R;
import com.xujiang.imitationcompanypj.model.UserActionItemEntity;

import java.util.List;

/**
 * Created by xujiang on 2017/4/1.
 */

public class UserCenterActionListAdapter extends BaseRecyclerAdapter<UserActionItemEntity,UserCenterActionListAdapter.ViewHolder> {


    public UserCenterActionListAdapter(Context context, List<UserActionItemEntity> list) {
        super(context,list);
    }



    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = inflate(R.layout.list_item_user_center_action,parent);
        return new ViewHolder(view);
    }

    @Override
    public void onBindViewHolderItem(ViewHolder holder, UserActionItemEntity item, int position) {
        UserActionItemEntity ua=getList ().get (position);
        holder.actionName.setText (ua.getUserActionName());
        Glide.with(getContext())
                .load(ua.getUserActionIconDrawableId())
                .into(holder.actionIcon);

    }


    public class ViewHolder extends BaseRecyclerViewHolder<String>
    {
        public TextView actionName;
        public ImageView actionIcon;

        public ViewHolder(View itemView){
            super(itemView);
            actionName = findViewById(R.id.user_center_action_name);
            actionIcon = findViewById(R.id.user_center_action_icon);
        }

    }
}
